<?php

  $detail = $ticket->readTicket(end($url));
  
  if(in_array('delete', $url) && $ses->get('rechte') == 'adm') {
    $ticket->deleteTicket(end($url));            
    header("Location: " . base::get('getPath') . "/ticket/index");
  }

  if(in_array('edit', $url)) {
    template::setText('edit', True);
  }
  
  if(in_array('save', $url)) {
    $_POST['anhang'] = $file->uploadFile($_FILES['filesToUpload']);    
    $ticket->saveNewTicket($_POST);
            
    header("Location: " . base::get('getPath') . "/ticket/detail/".end($url));
  }

  
  include_once 'ticket_details.php';

  // Alle Daten ins Template übergeben
  template::setText('detail', $detail);
 
  
?>

